//
//  FYBaseViewModel.h
//  ThePainter
//
//  Created by Sean on 15/8/13.
//  Copyright (c) 2015年 FeiYu. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol FYBaseViewModelDelegate <NSObject>

@required

- (void)loadNewData:(id)key valueBlock:(ReturnValueBlock)valueBlock errorBlock:(ErrorCodeBlock)errorBlock failureBlock:(FailureBlock)failureBlock;

- (void)loadMoreData:(id)key valueBlock:(ReturnValueBlock)valueBlock errorBlock:(ErrorCodeBlock)errorBlock failureBlock:(FailureBlock)failureBlock;

@end


@interface FYBaseViewModel : NSObject <FYBaseViewModelDelegate>

#pragma 监测网络的可链接性
- (BOOL) netWorkReachabilityWithURLString:(NSString *) strUrl;

#pragma POST请求
- (void) NetRequestPOSTWithRequestURL: (NSString *) requestURLString
                        WithParameter: (NSDictionary *) parameter
                 WithReturnValeuBlock: (ReturnValueBlock) block
                   WithErrorCodeBlock: (ErrorCodeBlock) errorBlock
                     WithFailureBlock: (FailureBlock) failureBlock;

#pragma GET请求
- (void) NetRequestGETWithRequestURL: (NSString *) requestURLString
                       WithParameter: (NSDictionary *) parameter
                WithReturnValeuBlock: (ReturnValueBlock) block
                  WithErrorCodeBlock: (ErrorCodeBlock) errorBlock
                    WithFailureBlock: (FailureBlock) failureBlock;

@end
